package com.codechuan.hallo_web.controller;

import com.codechuan.hallo_web.entity.SysUserAccountYk;
import com.codechuan.hallo_web.service.SysUserAccountYkService;
import com.codechuan.hallo_web.service.YkApiService;
import com.codechuan.hallo_web.utils.EncryptionUtil;
import com.codechuan.hallo_web.utils.ResultUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * @Deprecated 小叮当月卡项目
 */
@RestController
@RequestMapping(value = "/yk")
public class YkApiController {
    @Resource
    private YkApiService ykApiService;

    /**
     * @Deprecated 月卡登陆
     */
    @PostMapping(value = "/ykLogin")
    public String ykLogin(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.ykLogin(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 读取用户配置文件
     */
    @PostMapping(value = "/selectUserConfig")
    public String selectUserConfig(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.selectUserConfig(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 读取用户小号
     */
    @PostMapping(value = "/selectUserMiniToken")
    public String selectUserMiniToken(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.selectUserMiniToken(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 获取主号信息
     */
    @PostMapping(value = "/getUserAccountInfo")
    public String getUserAccountInfo(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.getUserAccountInfo(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }



    /**
     * @Deprecated 修改主号信息
     */
    @PostMapping(value = "/updateAccountToken")
    public String updateAccountToken(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.updateAccountToken(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }



    /**
     * @Deprecated 保存用户配置文件
     */
    @PostMapping(value = "/saveUserConfig")
    public String saveUserConfig(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.saveUserConfig(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 修改用户主号token状态
     */
    @PostMapping(value = "/updateAccountTokenStatus")
    public String updateAccountTokenStatus(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.updateAccountTokenStatus(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 修改用户小号token状态
     */
    @PostMapping(value = "/updateMiniTokenStatus")
    public String updateMiniTokenStatus(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.updateMiniTokenStatus(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 获取指定城市编码
     */
    @PostMapping(value = "/selectZdCsCityCode")
    public String selectZdCsCityCode(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.selectZdCsCityCode(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 添加用户小号
     */
    @PostMapping(value = "/addMiniToken")
    public String addMiniToken(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.addMiniToken(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }



    /**
     * @Deprecated 删除用户小号
     */
    @PostMapping(value = "/deleteUserMiniToken")
    public String deleteUserMiniToken(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.deleteUserMiniToken(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 添加用户订单
     */
    @PostMapping(value = "/addUserOrder")
    public String addUserOrder(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.addUserOrder(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * @Deprecated 删除所有用户订单
     */
    @PostMapping(value = "/deleteOrderInfo")
    public String deleteOrderInfo(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.deleteOrderInfo(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 查询所有用户订单
     */
    @PostMapping(value = "/selectUserOrderListByAccount")
    public String selectUserOrderListByAccount(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.selectUserOrderListByAccount(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * @Deprecated 解绑月卡
     */
    @PostMapping(value = "/ykNoBind")
    public String ykNoBind(@RequestBody HashMap<String, String> hashMap) {
        try {
            return EncryptionUtil.encrypt(ykApiService.ykNoBind(hashMap));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }




}
